﻿using SqlSugar;
using System;
using System.Linq;
using System.Text;

namespace FytSoa.Core.Model.Sw
{
    ///<summary>
    ///商城-优惠券生成表 
    ///</summary>
    public partial class Sw_coupon
    {
        public Sw_coupon()
        {


        }
        /// <summary>
        /// Desc:唯一编号
        /// Default:
        /// Nullable:False
        /// </summary>           
        public string Guid { get; set; }

        /// <summary>
        /// Desc:优惠券名称
        /// Default:
        /// Nullable:False
        /// </summary>           
        public string CouponName { get; set; }

        /// <summary>
        /// Desc:优惠券类型 优惠券类型1=购物券2=运费券
        /// Default:1
        /// Nullable:False
        /// </summary>           
        public int CouponTypes { get; set; }

        /// <summary>
        /// Desc:会员类型 优惠券类型1=全场通用，2=指定会员
        /// Default:1
        /// Nullable:False
        /// </summary>           
        public int MemberTypes { get; set; } = 1;

        /// <summary>
        /// Desc:会员使用登记
        /// Default:
        /// Nullable:True
        /// </summary>           
        public string MemberGradeGuid { get; set; }

        /// <summary>
        /// Desc:抵用金额
        /// Default:0.00
        /// Nullable:False
        /// </summary>           
        public decimal WorthMoney { get; set; } = 0;

        /// <summary>
        /// Desc:是否最低金额使用
        /// Default:0
        /// Nullable:False
        /// </summary>           
        public bool IsMinMoney { get; set; } = false;

        /// <summary>
        /// Desc:最低金额
        /// Default:0.00
        /// Nullable:False
        /// </summary>           
        public decimal MinMoney { get; set; } = 0;

        /// <summary>
        /// Desc:生成数量
        /// Default:1
        /// Nullable:False
        /// </summary>           
        public int Amount { get; set; } = 0;

        /// <summary>
        /// Desc:优惠券使用方式  1=立减2=折扣3=返利
        /// Default:1
        /// Nullable:False
        /// </summary>           
        public int Mode { get; set; } = 1;

        /// <summary>
        /// Desc:Json{立减：0，折扣：1，返积分：2，返余额：3}
        /// Default:
        /// Nullable:True
        /// </summary>     
        [SugarColumn(IsJson = true)]
        public CouponMode ModeJson { get; set; } = new CouponMode();

        /// <summary>
        /// Desc:是否开启指定商品分类
        /// Default:1
        /// Nullable:False
        /// </summary>           
        public bool IsCategory { get; set; } = false;

        /// <summary>
        /// Desc:分类集合
        /// Default:
        /// Nullable:True
        /// </summary>           
        public string CategoryList { get; set; }

        /// <summary>
        /// Desc:是否指定特定商品使用
        /// Default:1
        /// Nullable:False
        /// </summary>           
        public bool IsGoods { get; set; } = false;

        /// <summary>
        /// Desc:商品集合
        /// Default:
        /// Nullable:True
        /// </summary>           
        public string GoodsList { get; set; }

        /// <summary>
        /// Desc:优惠券开始有效期
        /// Default:
        /// Nullable:False
        /// </summary>           
        public DateTime? BeginTime { get; set; }

        /// <summary>
        /// Desc:优惠券结束有效期
        /// Default:
        /// Nullable:False
        /// </summary>           
        public DateTime? EndTime { get; set; }

        /// <summary>
        /// Desc:创建时间
        /// Default:
        /// Nullable:False
        /// </summary>           
        public DateTime AddTime { get; set; } = DateTime.Now;

    }

    /// <summary>
    /// 优惠券方式值
    /// </summary>
    public class CouponMode
    {
        /// <summary>
        /// 抵扣金额
        /// </summary>
        public decimal deduction { get; set; } = 0;

        /// <summary>
        /// 折扣
        /// </summary>
        public decimal discount { get; set; } = 0;

        /// <summary>
        /// 返余额
        /// </summary>
        public decimal backmoney { get; set; } = 0;

        /// <summary>
        /// 返积分
        /// </summary>
        public decimal backpoint { get; set; } = 0;
    }
}
